<head th:fragment="header">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.css" th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../static/ajax/libs/bootstrap-table/bootstrap-table.min.css"
          th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
    <link href="../static/ajax/libs/jqTreeGrid/jquery.treegrid.css"
          th:href="@{/ajax/libs/jqTreeGrid/jquery.treegrid.css}" rel="stylesheet"/>
    <link href="../static/css/animate.css" th:href="@{/css/animate.css}" rel="stylesheet"/>
    <link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
    <link href="../static/css/checkbox.css" th:href="@{/css/checkbox.css}" rel="stylesheet"/>
    <script src="../static/js/jquery. min.js" th:src="@{/js/jquery.min.js}"></script>
    <script src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
    <script src="../static/js/wangEditor.min.js" th:src="@{/js/wangEditor.min.js}"></script>
</head>
<div th:fragment="footer">


    <!-- bootstrap-table 表格插件 -->
    <script src="../static/ajax/libs/bootstrap-table/bootstrap-table.min.js"
            th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js}"></script>
    <script src="../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
            th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
    <script src="../static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"
            th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js}"></script>
    <script src="../static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"
            th:src="@{/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js}"></script>
    <!-- jquery-validate 表单验证插件 -->
    <script src="../static/ajax/libs/validate/jquery.validate.min.js"
            th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
    <script src="../static/ajax/libs/validate/messages_zh.min.js"
            th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>
    <script src="../static/ajax/libs/validate/jquery.validate.extend.js"
            th:src="@{/ajax/libs/validate/jquery.validate.extend.js}"></script>
    <!-- jquery-validate 表单树插件 -->
    <script src="../static/ajax/libs/jqTreeGrid/jquery.treegrid.min.js"
            th:src="@{/ajax/libs/jqTreeGrid/jquery.treegrid.min.js}"></script>
    <script src="../static/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js"
            th:src="@{/ajax/libs/jqTreeGrid/jquery.treegrid.extension.js}"></script>
    <!-- jquery-export 表格导出插件 -->
    <script src="../static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"
            th:src="@{/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js}"></script>
    <script src="../static/ajax/libs/bootstrap-table/extensions/export/tableExport.js"
            th:src="@{/ajax/libs/bootstrap-table/extensions/export/tableExport.js}"></script>
    <script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
    <script src="../static/reasahi/js/common.js?v=1.1.6" th:src="@{/reasahi/js/common.js?v=1.1.6}"></script>
    <script src="../static/reasahi/js/ry-ui.js?v=1.1.6" th:src="@{/reasahi/js/ry-ui.js?v=1.1.6}"></script>
    <script src="../static/js/vue.js" th:src="@{/js/vue.js}"></script>
    <script src="/js/laydate/laydate.js" th:src="@{/js/laydate/laydate.js}"></script>
    <script th:inline="javascript"> var ctx = [[@{
        /}]];</script>
    <script th:inline="javascript"> var qniu = [[${qniuUrl}]]; </script>
    <!--<script src="http://tajs.qq.com/stats?sId=62048022"></script>-->
</div>

<div th:fragment="editor">
   <!-- <input type="hidden" name="content" id="editContent" value=""/>
    <div id="editor"></div>-->

    <script type="text/javascript">
        init();

        function init() {

            var E = window.wangEditor;
            var editor = new E('#editor');
            editor.customConfig.showLinkImg = false;
            editor.customConfig.uploadImgHooks = {
                before: function (xhr, editor, files) {
                    // 图片上传之前触发
                    // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，files 是选择的图片文件

                    // 如果返回的结果是 {prevent: true, msg: 'xxxx'} 则表示用户放弃上传
                    // return {
                    //     prevent: true,
                    //     msg: '放弃上传'
                    // }
                },
                success: function (xhr, editor, result) {
                    // 图片上传并返回结果，图片插入成功之后触发
                    // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，result 是服务器端返回的结果
                },
                fail: function (xhr, editor, result) {
                    // 图片上传并返回结果，但图片插入错误时触发
                    // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，result 是服务器端返回的结果
                },
                error: function (xhr, editor) {
                    // 图片上传出错时触发
                    // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象
                },
                timeout: function (xhr, editor) {
                    // 图片上传超时时触发
                    // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象
                },

                // 如果服务器端返回的不是 {errno:0, data: [...]} 这种格式，可使用该配置
                // （但是，服务器端返回的必须是一个 JSON 格式字符串！！！否则会报错）
                customInsert: function (insertImg, result, editor) {
                    // 图片上传并返回结果，自定义插入图片的事件（而不是编辑器自动插入图片！！！）
                    // insertImg 是插入图片的函数，editor 是编辑器对象，result 是服务器端返回的结果
                    // 举例：假如上传图片成功后，服务器端返回的是 {url:'....'} 这种格式，即可这样插入图片：
                    if (result.code === '000000') {
                        var url = result.url;
                        insertImg(url)
                    }
                    if (result.code === "100000") {
                        alert(result.msg)

                    }
                    // result 必须是一个 JSON 格式字符串！！！否则报错
                }
            };
            editor.customConfig.uploadFileName = 'files';
            editor.customConfig.uploadImgServer = '[[@{/manage/upload/upload}]]';
            var $text1 = $('#editContent');
            editor.customConfig.onchange = function (html) {
                // 监控变化，同步更新到 textarea
                $text1.val(html)
            };
            editor.create();
            editor.txt.html($("#editContent").val());
            $text1.val(editor.txt.html())

        }
    </script>
</div>

<!---图片文件上传工具--->

<div th:fragment="imageUpload">
    <script src="../static/js/qniu/moxie.js?v=1.1.6" th:src="@{/js/qniu/moxie.js?v=1.1.6}"></script>
    <script src="../static/js/qniu/plupload.dev.js?v=1.1.6" th:src="@{/js/qniu/plupload.dev.js?v=1.1.6}"></script>
    <script src="../static/js/qniu/qiniu.min.js?v=1.1.6" th:src="@{/js/qniu/qiniu.min.js?v=1.1.6}"></script>
    <script>
        var uploader = Qiniu.uploader({
            runtimes: 'html5,flash,html4',
            browse_button: 'pic',
            uptoken_url: '[[@{/manage/upload/getToken}]]',
            get_new_uptoken: true,
            domain: '[[${qniuUrl}]]',
            max_file_size: '1024mb',
            flash_swf_url: '/framework/plupload/js/Moxie.swf',
            max_retries: 3,
            dragdrop: true,
            chunk_size: '4mb',
            filters: {
                max_file_size: '5mb',
                mime_types: [
                    {title: "files", extensions: "BMP,JPG,JPEG,PNG,GIF"}
                ]
            },
            rename: false,
            auto_start: true,
            init: {
                'FilesAdded': function(up, files) {
                    plupload.each(files, function(file) {
                    });
                },
                'BeforeUpload': function(up, file) {

                },
                'UploadProgress': function(up, file) {
                    var percent = file.percent;
                    $("#pic").text('上传进度:'+percent+"%");

                },
                'FileUploaded': function(up, file, info) {
                    var domain = up.getOption('domain');
                    var res = JSON.parse(info.response);
                    $('#img').val(domain+"/"+res.key);
                    $("#image").attr("src",domain+"/"+res.key).css("visibility","visible");
                },
                'Error': function(up, err, errTip) {

                },
                'UploadComplete': function() {
                },
                'Key': function(up, file) {
                    var key =file.getName;
                    return key
                }
            }
        });
        </script>
</div>









